package T1;

public class Student extends Person{
        private int no;
        private double scoreEn;
        private double scoreMath;
        private double scoreCh;


    public Student() {
    }


    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public double getScoreEn() {
        return scoreEn;
    }

    public void setScoreEn(double scoreEn) {
        this.scoreEn = scoreEn;
    }

    public double getScoreMath() {
        return scoreMath;
    }

    public void setScoreMath(double scoreMath) {
        this.scoreMath = scoreMath;
    }

    public double getScoreCh() {
        return scoreCh;
    }

    public void setScoreCh(double scoreCh) {
        this.scoreCh = scoreCh;
    }


    public double aver(){
       return (scoreEn + scoreCh + scoreMath) / 3;
    }
    public double max(){
        if (scoreMath>scoreCh && scoreCh>scoreEn){
            return(scoreMath);
        }else if (scoreEn>scoreMath&&scoreMath>scoreCh){
            return(scoreEn);

        }else{
            return(scoreCh);
        }


    }
    public  double min(){
        if (scoreCh<scoreEn&&scoreEn<scoreMath){
            return(scoreCh);
        } else if (scoreEn<scoreMath&&scoreMath<scoreCh) {
            return(scoreEn);
        }else {
            return(scoreMath);
        }


    }

    @Override
    public String toString() {
        return "Student{" +
                "学号=" + no +
                ", 平均分=" + aver() +
                ", 最高分=" + max()+
                ", 最低分=" + min() +
                ", 名字='" + name + '\'' +
                ", 性别='" + sex + '\'' +
                ", 年龄=" + age +
                '}';
    }
}
